<?php

namespace App\Http\Middleware;

use Closure;

class CheckReferer
{
    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @return mixed
     */
    public function handle($request, Closure $next)
    {
        if(isset($_SERVER['HTTP_REFERER'])){
            if(strpos($_SERVER['HTTP_REFERER'],env('APP_URL'))===FALSE){
                echo "您没有访问权限";exit;
            }
        }else{
            echo "您没有访问权限";exit;
        }
        return $next($request);
    }
}
